<?php
//
// +------------------------------------------------------------------------+
// | PHP Version 5.4                                                        |
// +------------------------------------------------------------------------+
// | Copyright (c) All rights reserved.                                     |
// +------------------------------------------------------------------------+
// | 世纪车来车往(北京）网络科技有限公司 版权所有!                                 |
// | TEL:010-63732365  HOTLINE:400-6688-365  EMAIL:clcw@clcw.com.cn         |
// | $Revision: 1.0 $                                                       |
// +------------------------------------------------------------------------+
// | Author: Xmh<xiangminghu@clcw.com.cn>                                   |
// +------------------------------------------------------------------------+
//

namespace AuctionBack\Logic;


class RewardLogic extends BaseLogic
{
    protected $autoCheckFields = false;

    protected $rewardModel;

    public function _initialize()
    {
        $this->rewardModel = D('Reward', 'Model');
    }

    /**
     * 新增奖励总账记录
     *
     * @param $aid
     * @param $otherAid
     * @param $type
     * @param $cash
     * @param $integral
     * @param $growth
     *
     * @return bool|mixed
     */
    public function add($aid, $otherAid, $type, $cash, $integral, $growth)
    {
        if (intval($aid) < 1 || intval($otherAid) < 1 || $type < 1) {
            return false;
        }
        $data = [
            'aid'         => $aid,
            'other_aid'   => $otherAid,
            'type'        => $type,
            'cash'        => $cash,
            'integral'    => $integral,
            'growth'      => $growth,
            'create_time' => time()
        ];
        $rId = $this->rewardModel->add($data);
        return $rId;
    }
}